home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat3 / setgrent.3 < prev    next >
Encoding:
Text File  |  1993-03-03  |  3.1 KB  |  133 lines

  1.  
  2.  
  3.  
  4. GETGRENT(3)         MINTLIB LIBRARY FUNCTIONS         GETGRENT(3)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        getgrent,  getgrgid,  getgrnam,  setgrent, endgrent, fget-
  9.        grent - get group file entry
  10.  
  11. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  12.        #include <stdio.h>
  13.        #include <grp.h>
  14.  
  15.        struct group *getgrent(void);
  16.  
  17.        struct group *getgrgid(int gid);
  18.  
  19.        struct group *getgrnam(const char *name);
  20.  
  21.        void setgrent(void);
  22.  
  23.        void endgrent(void);
  24.  
  25.        struct group *fgetgrent(FILE *f);
  26.  
  27. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  28.        getgrent, getgrgid and getgrnam each returns a pointer  to
  29.        an  object  containing  the broken-out fields of a line in
  30.        the /etc/group file.  Each line in  the  file  contains  a
  31.        "group" structure, declared in the <grp.h> header file:
  32.          struct group
  33.          {
  34.            char  *gr_name;   /* name of the group     */
  35.            char  *gr_passwd; /* encrypted password    */
  36.            gid_t gr_gid;     /* numerical group ID    */
  37.            char  **gr_mem;   /* array of member names */
  38.          };
  39.  
  40.        getgrent  when first called returns a pointer to the first
  41.        group structure in the  file;  thereafter,  it  returns  a
  42.        pointer  to  the next group structure in the file; so suc-
  43.        cessive calls can be used to search the entire file.
  44.  
  45.        getgrgid searches from the beginning of the file  until  a
  46.        numerical  group  ID  is  found  matching gid is found and
  47.        returns a pointer to the particular structure in which  it
  48.        was found.  Thus, it cannot be found to search for several
  49.        groups having duplicate numerical group IDs.
  50.  
  51.        getgrnam searches from the beginning of the file  until  a
  52.        group name matching name is found and returns a pointer to
  53.        the particular structure in which it was found.
  54.  
  55.        If an EOF or an error is encountered on reading, getgrent,
  56.        getgrgid and getgrnam return a NULL pointer.
  57.  
  58.        A  call  to setgrent has the effect of rewinding the group
  59.        file to allow repeated searches.
  60.  
  61.  
  62.  
  63.  
  64. MiNT docs 0.1              3 March 1993                         1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GETGRENT(3)         MINTLIB LIBRARY FUNCTIONS         GETGRENT(3)
  71.  
  72.  
  73.        endgrent may be called to close the group file  when  pro-
  74.        cessing is complete.
  75.  
  76.        fgetgrent returns a pointer to the next group structure in
  77.        the stream f, which matches the format of /etc/group.
  78.  
  79. F✓FI✓IL✓LE✓ES✓S
  80.        /etc/group
  81.  
  82. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  83.        g✓ge✓et✓tl✓lo✓og✓gi✓in✓n(✓(3✓3)✓),✓, g✓ge✓et✓tp✓pw✓we✓en✓nt✓t(✓(3✓3)✓)
  84.  
  85. N✓NO✓OT✓TE✓ES✓S
  86.        All information is contained in a static area, so it  must
  87.        be copied if it is to be saved.
  88.  
  89.        These routines cannot handle groups with over 128 members.
  90.  
  91.        These routines expect the group file to be of  type  text,
  92.        and can therefore read both DOS and UN*X format files.
  93.  
  94.        fgetgrent is not standard, but is available on System V.
  95.  
  96.        For group files, there's no equivalent to putpwent.
  97.  
  98.        The password field of groups is seldom used.
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. MiNT docs 0.1              3 March 1993                         2
  131.  
  132.  
  133.